fix(app): navigate to selected directory instead of project root when opening sandbox - #33678
fix(app): navigate to selected directory instead of project root when opening sandbox#33678bytethm wants to merge 1 commit into
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: The search results show PR #33678 (the current PR) plus a related PR that might be relevant: Potentially Related PR:
However, this appears to be a different issue—#30685 focuses on stale project roots, while #33678 fixes the fallback navigation target in No duplicate PRs found |
|
撤回,需要进一步排查根因 |
Description
When a user opens a directory that belongs to an existing project as a sandbox (e.g., a copied repo with the same git root hash), the app navigates to the project's primary worktree instead of the user-selected directory.
This happens because
navigateToProjectalways navigates toroot(the project's worktree fromprojectRoot()) rather than thedirectoryparameter that was passed in.Root Cause
MCP-FRAMEWORKSandMCP-FRAMEWORKS_copy) share the same git root hashProjectV2.resolvegenerates the same project ID for bothProject.fromDirectorypreserves the existing worktree and adds the new directory as a sandboxprojectRoot()returns the project worktree, not the sandbox pathnavigateToProjectused the worktree as the final navigation targetFix
Changed the final navigation fallback in
navigateToProjectfromroot(project worktree) todirectory(the user's actual selected directory). Existing session navigation already correctly usestarget.directory, so only the fallback (when no existing session is found) was affected.Verification
bun turbo typecheckpasses on all 24 packages